<?php if(!defined('HOST'))die('not access');?>
<script >
$(document).ready(function(){
	{params};
	var atype=params.atype;
	var a = $('#veiw_{rand}').bootstable({
		tablename:'zbcg_new',celleditor:true,sort:'id',dir:'desc',modedir:'{mode}:{dir}',params:{'atype':atype},checked:true,fanye:true,
		storebeforeaction:'cgbefore',
		columns:[{
			text:'项目名称',dataIndex:'projectname'
		}
		/**/
		,{
		text:'状态',dataIndex:'status',align:'left',renderer:function(v,d){
				if(d.status == 1){
					v="<span style='color:green'>审批完成</span>";
				}else{
					v="<span style='color:red'>审批中</span>";
				}
				return v;
			},renderstyle:function(){
				return 'word-wrap:break-word;word-break:break-all;white-space:normal;';
			}
		}
		
		,{
			text:'类型',dataIndex:'projecttype',sortable:true
		},{
			text:'操作时间',dataIndex:'optdt'
		},{
			text:'说明',dataIndex:'explain'
		},{
			text:'预算金额',dataIndex:'budget'
		},{
			text:'审减后金额',dataIndex:'aftercheckmoney'
		},{
			text:'中标金额',dataIndex:'zbmoney'
		},{
			text:'节约金额(预算金额)',dataIndex:'savemoney_ys'
		},{
			text:'节约率(预算)',dataIndex:'saverate_ys'
		},{
			text:'代理机构',dataIndex:'proxygov'
		},{
			text:'进展情况',dataIndex:'proprogress'
		},{
			text:'报名单位情况',dataIndex:'signupcompany'
		},{
			text:'完标时间',dataIndex:'wbtime'
		},{
			text:'中标单位',dataIndex:'zbcompany'
		},{
			text:'项目负责人',dataIndex:'projectadminer'
		},{
			text:'节约金额(审减)',dataIndex:'savemoney_sj'
		},{
			text:'节约率(审减)',dataIndex:'saverate_sj'
		},{
			text:'合同是否签订',dataIndex:'issignagreement'
		},{
			text:'档案整理情况',dataIndex:'projectfiles'
		},{
			text:'所属单位',dataIndex:'projectcompany'
		},{
			text:'批准书文号',dataIndex:'projecticp'
		},{
			text:'批准书获得时间',dataIndex:'proicptime'
		}],
		rendertr:function(d){
			var s = '';
			if(d.level==2)s='style="color:red"';
			return s;
		}
	});
	

	var c = {
		delss:function(){
			a.del({url:js.getajaxurl('dellog','{mode}','{dir}'),checked:true});
		},
		search:function(){
			var s=get('key_{rand}').value;
			var sdate=get('startdt_{rand}').value;
			var edate=get('enddt_{rand}').value;
			a.setparams({key:s,sdate:sdate,edate:edate},true);
		},
		daochu:function(){
			a.exceldown();
		},
		weeksearch:function(){
			var weekFirstDay = showWeekFirstDay() + " 00:01:01";
			var weekLastDay = showWeekLastDay() + " 23:59:59";
//			alert(showWeekFirstDay() + " -- " + showWeekLastDay());
			$("#startdt_{rand}").val(weekFirstDay);
			$("#enddt_{rand}").val(weekLastDay);
			a.setparams({sdate:weekFirstDay,edate:weekLastDay},true);
		},
		monthsearch:function(){
			var monthFirstDay = showMonthFirstDay() + " 00:01:01";
			var monthLastDay = showMonthLastDay() + " 23:59:59";
			$("#startdt_{rand}").val(monthFirstDay);
			$("#enddt_{rand}").val(monthLastDay);
			a.setparams({sdate:monthFirstDay,edate:monthLastDay},true);
		},
		quartersearch:function(){
			var sday = getQuarterFirstDay();
			var eday = getQuarterLastDay();
			$("#startdt_{rand}").val(sday);
			$("#enddt_{rand}").val(eday);
			a.setparams({sdate:sday,edate:eday},true);
		},
		yearsearch:function(){
			var today = new Date();
			var y = today.getFullYear();
			var sday = y+"-01-01 01:01:01";
			var eday = y+"-12-31 23:59:59";
			$("#startdt_{rand}").val(sday);
			$("#enddt_{rand}").val(eday);
			a.setparams({sdate:sday,edate:eday},true);
		}
	};
	js.initbtn(c);

    var date=new Date;
    var y = date.getFullYear()
    $('#startdt_{rand}').val(y+'-01-01');
});
</script>


<div>


<table width="100%"><tr>
	<td>
		<input class="form-control" style="width:300px" id="key_{rand}" placeholder="项目类型/项目名称">
	</td>
	<td>
		开始时间<input class="form-control" onclick="js.datechange(this,'datetime')" value="" onblur="a.inputblur(this, 0)" class="inputs datesss" inputtype="datetime" readonly="" id="startdt_{rand}">
	</td>
	<td>
		结束时间<input class="form-control" onclick="js.datechange(this,'datetime')" value="" onblur="a.inputblur(this, 0)" class="inputs datesss" inputtype="datetime" readonly="" id="enddt_{rand}">
	</td>
	<td nowrap style="padding-left:10px">
		<button class="btn btn-default" click="search" type="button">搜索</button>&nbsp; 
		<button class="btn btn-default" click="daochu,1" type="button">导出</button>
		<button class="btn btn-default" click="weeksearch" type="button">周报表查询</button>&nbsp; 
		<button class="btn btn-default" click="monthsearch" type="button">月报表查询</button>&nbsp; 
		<button class="btn btn-default" click="quartersearch" type="button">季报表查询</button>&nbsp; 
		<button class="btn btn-default" click="yearsearch" type="button">年报表查询</button>&nbsp; 
	</td>
	<td align="right" nowrap>
		<!-- 
	<td width="80%"></td>
		<button class="btn btn-danger" id="del_{rand}" click="delss" type="button"><i class="icon-trash"></i> 删除</button>
		 -->
	</td>
</tr>
</table>
</div>
<div class="blank10"></div>
<div id="veiw_{rand}"></div>